<template>
	<div class="container">
		<div class="jx-container">
      <div class="select-type">
        <div class="item table-item">
          <div class="right">
            <div class="item-inline">
              <span>产品名称</span>
              <el-input class="tel-value" v-model="params_list.name" placeholder="请输入产品名称"></el-input>
            </div>
            <div class="item-inline">
              <span>商品类型</span>
              <el-select class="tel-value" v-model="params_list.type" placeholder="请选择">
                <el-option label="核销商品" value="1"></el-option>
                <el-option label="实物" value="2"></el-option>
              </el-select>
            </div>
            <div class="item-inline">
              <el-button class="jx-btn" type="primary" @click="search">搜索</el-button>
            </div>
          </div>
        </div>
      </div>
      <div class="jx-table">
        <div class="title">
          <img class="icon" src="/static/img/icon-platform.png"/>
          供应商门店产品列表
          <div class="add-new">
            <el-button class="jx-btn" type="primary" @click="addRow">添加商品</el-button>
            <el-button class="jx-btn" type="primary" :loading="boo.isExport" @click="exportRow">{{boo.isExport ? '请稍后……' : '导出'}}</el-button>
          </div>
        </div>
        <el-table :data="supplierlist" border style="width: 100%" v-loading="boo.loading">
          <el-table-column type="index" label="序列" width="55" align="center">
            <template slot-scope="scope">
              <span>{{(scope.$index + 1) + ((params_list.page - 1) * params_list.size)}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="img" label="产品图片" width="130" align="center">
            <template slot-scope="scope">
              <img class="logo" :src="scope.row.img"/>
            </template>
          </el-table-column>
          <el-table-column prop="name" label="产品名称" width="150" align="center" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <el-button @click="viewRow(scope.row)" type="text" size="small">{{scope.row.name}}</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="spu" label="供应商" align="center" :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column prop="address" label="所在地区" align="center" :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column prop="price" label="供应价格" align="center" :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column prop="old_price" label="采购价格" align="center" :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column prop="sum" label="库存数量" align="center">
          </el-table-column>
          <el-table-column prop="type" label="商品类型" align="center" >
          </el-table-column>
          <el-table-column prop="status" label="状态" align="center">
            <template slot-scope="scope">
              {{scope.row.status == 1 ? '正常' : '已暂停'}}
            </template>
          </el-table-column>
          <el-table-column label="操作" width="120" align="center">
            <template slot-scope="scope">
              <el-button @click="hiddenRow(scope.row)" type="text" size="small">暂停</el-button>
              <el-button @click="deteleRow(scope.row)" type="text" size="small">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div v-if="supplierlist.length != 0" class="jx-pagination">
          <el-pagination @current-change="pageChange" @size-change="handleSizeChange" :current-page="params_list.page" :page-sizes="[10,50,100]" :page-size="params_list.size" layout="total, sizes, prev, pager, next, jumper"
            :total="other.allRow">
          </el-pagination>
        </div>
      </div>
    </div>
    <!-- 添加产品 -->
    <el-dialog  :visible.sync="boo.showDialog" class="jx-dialog" width="75%">
      <div slot="title" class="header-title">
        <span class="title-name">添加产品</span>
      </div>
      <div class="jx-detail">
        <div class="detail-item">
          <div class="item_2">
            <div class="title">基本信息</div>
            
          </div>
        </div>
        <div class="detail-item">
          <div class="item">
            <div class="title">产品图片</div>
            
          </div>
        </div>
      </div> 
    </el-dialog>
	</div>
</template>

<script>
  import supplierlist from 'static/json/product/supplierlist.json'
	export default {
		data() {
			return {
        boo: {
          loading: false,
          showDialog: false,
        },
        other: {
          allRow: 1,
        },
        supplierlist: supplierlist,
        params_list: {
          page: 1,
          size: 10,
          type: '',
          name: '',
        },
			}
		},
		mounted(){
      let _self = this
      _self.getList()
    },
		methods: {
      getList(){},
      pageChange(val){
        let _self = this
        _self.params_list.page = val
        _self.getList()
      },
      handleSizeChange(val) {
        let _self = this
        _self.params_list.size = val
        _self.getList()
      },
      search(){
        let _self = this
      },
      addRow(){
        let _self = this
        // _self.boo.showDialog = true
      },
      exportRow(){},
      hiddenRow(){
        
      },
      deteleRow(){},
      viewRow(item){
        // let _self = this
        // let params = {
        //   path: '/product/detail/product_detail?id=',
        //   query: item.id
        // }
        // _self.$router.push(params.path + params.query)
      }
    }
	}

</script>
<style scoped lang="sass">
  .select-type .table-item .right span
    width: 62px
  .jx-table
    /deep/ .el-table__body td
      .cell
        height: auto
        line-height: auto
</style>
